1. Field of the Invention
The present invention relates to the field of streaming applications and dynamic linked libraries (DLL). More particularly, the present invention relates to a method and an apparatus for controlling the loading and unloading of dynamic linked libraries in a streaming application.
2. Description of Related Art
The dynamic linked library is a library comprising data and computer code that can be used simultaneously by a plurality of programs. In present operation systems, many functions are provided by dynamic linked libraries (DLLs). For example, in the Windows operation system, the dialog box related functions are executed by the Comdlg32 DLL. Therefore, any program can use the functions in this DLL to “open” a dialog box. In addition, many functions of application running on the operation system can also be provided by DLLs. For example, a certain application can include a plurality of different modules with each module being included in and distributed from DLLs.
Advantages of using DLLs include facilitating the modularization and reuse of computer code, improving the effective usage of memory and reducing the occupied disk space. Therefore, the operation system and programs can be loaded and run faster as well as use less disk space.
Currently, DLLs are loaded by the operating system when the DLL is first called and unloaded when the calling program ends or when the memory is needed. However, in most streaming applications, the main program is usually running constantly. This loads a large number of DLLs during the main program's lifetime and uses a large amount of memory. This problem is compounded by the fact that streaming program languages currently do not support branch structures which enable conditional loading and unloading of certain DLLs. This leads to streaming programs being unable to properly control the loading and unloading of DLLs from memory. Since the operating system can only determine when a program has ended, the operating system is unable to determine whether a DLL called by a running program needs to be unloaded. This leads to several problems. First, these Blind-Running DLLs can take hundreds of mega bytes in memory space. This leads to DLLs being left in memory unused which is an inefficient use of system resources. Second, these DLLs must be constantly monitored by the operating system in order to ensure proper execution of the system. Therefore, a solution for managing the loading and unloading of DLLs is needed which would improve the usage efficiency of system resources.